package com.lihepeng.leecode.tree;

/**
 * 二叉 平衡树
 * 左侧节点小于，右侧节点大于
 *
 * @param <T>
 */
public class BinSearchTree<T> implements BinaryTree<T> {
    private Node<T> rootNode;

    @Override
    public boolean isEmpty() {
        return false;
    }

    @Override
    public int size(Node<T> root) {
        return 0;
    }

    @Override
    public int getHeigh(Node<T> root) {
        return 0;
    }

    @Override
    public Node findKey() {
        return null;
    }

    @Override
    public void preOrderTravel() {

    }

    @Override
    public void inOrderTravel() {

    }

    @Override
    public void afterOrderTravel() {

    }

    @Override
    public void levelOrder() {

    }

    @Override
    public void lookByLeft() {

    }

    public Node find(int key) {
        Node currentNode = rootNode;
        if (key == (Integer) currentNode.value) {
            return currentNode;
        } else if (key < (Integer) currentNode.value) {
            currentNode = currentNode.leftChild;
        } else {
            currentNode = currentNode.rightChild;
        }
        return null;
    }

}
